package com.ybvtc.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ybvtc.domain.Book;
import com.ybvtc.domain.User;
import com.ybvtc.service.BookService;
import com.ybvtc.mapper.BookMapper;
import org.springframework.stereotype.Service;

/**
* @author Administrator
* @description 针对表【book】的数据库操作Service实现
* @createDate 2024-05-29 14:14:42
*/
@Service
public class BookServiceImpl extends ServiceImpl<BookMapper, Book>
    implements BookService{

    @Override
    public IPage<Book> selectNewbooks() {
        int pageNum=1;
        int pageSize=6;
        // 要显示的页码和每页显示条数，进行封装
        Page<Book> bookPage = new Page<>(pageNum, pageSize);
        // 封装条件
        LambdaQueryWrapper<Book> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.ne(Book::getStatus,"3");
        queryWrapper.orderByDesc(Book::getUploadtime);

        return page(bookPage,queryWrapper);
    }

    @Override
    public Book findById(Book book) {
        LambdaQueryWrapper<Book> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(Book::getId,book.getId());
        getOne()
        return null;
    }


}




